package com.mao.crowd.controller;

import com.mao.crowd.entity.vo.AddressVO;
import com.mao.crowd.entity.vo.OrderProjectVO;
import com.mao.crowd.service.api.OrderService;
import com.mao.crowd.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Administrator
 * @description:
 * @cteate 2021-06-28-21:40
 */
@RestController
public class OrderProviderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("/get/order/project/vo/remote")
    ResultEntity<OrderProjectVO> getOrderProjectVORemote(@RequestParam("projectId") Integer projectId, @RequestParam("returnId") Integer returnId){

        try {
            OrderProjectVO orderProjectVO = orderService.getOrderProjectVO(projectId,returnId);

            return ResultEntity.successWithData(orderProjectVO);
        }catch (Exception e){
            return ResultEntity.failed(e.getMessage());
        }
    }


    @RequestMapping("/get/address/vo/remote")
    ResultEntity<List<AddressVO>> getAddressVORemote(@RequestParam("memberId") Integer memberId){
        try {
            List<AddressVO> addressVOList = orderService.getAddressVOList(memberId);
            return ResultEntity.successWithData(addressVOList);
        }catch (Exception e){
            return ResultEntity.failed(e.getMessage());
        }
    }
}
